package com.css;

import com.css.check.ReadStaticPaper;
import com.css.job.ValidateJob;
import org.apache.log4j.Logger;
import org.quartz.CronScheduleBuilder;
import org.quartz.JobBuilder;
import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.Trigger;
import org.quartz.TriggerBuilder;
import org.quartz.impl.StdSchedulerFactory;

public class HeartbeatMain {
    private static Logger logger = Logger.getLogger(ReadStaticPaper.class);

    public static void main(String[] args) throws SchedulerException {
        logger.error("开始测试");

        JobDetail job = JobBuilder.newJob(ValidateJob.class)
                .withIdentity("dummyJobName", "group1").build();

        Trigger trigger = TriggerBuilder
                .newTrigger()
                .withIdentity("dummyTriggerName", "group1")
                .withSchedule(CronScheduleBuilder.cronSchedule("0 */5 * * * ?")) // 每5分钟执行一次
                .build();


        Scheduler scheduler = new StdSchedulerFactory().getScheduler();
        scheduler.start();
        scheduler.scheduleJob(job, trigger);
    }
}
